import { getAttributes } from '@/shared';
import renderTemplate from './template';
import { Selector } from './config';
export default class SenButton extends HTMLElement {
  config: any;
  constructor() {
    super();
    this.render();
  }
  // 生命周期
  connectedCallback() {}
  attributeChangedCallback(name: string, oldValue: any, newValue: any) {
    console.log(name, 'name', oldValue, 'oldValue', newValue, 'newValue');
  }
  // 挂载监听事件
  mountEventListener() {}
  // 渲染函数
  render() {
    this.config = { ...getAttributes(this), ...this.config };
    const shadowRoot = this.attachShadow({ mode: 'open' });
    shadowRoot.innerHTML = renderTemplate(this.config);
  }
}
if (!customElements.get(Selector)) {
  customElements.define(Selector, SenButton);
}
